cmake_minimum_required(VERSION 2.8 FATAL_ERROR)

# NOTE, the order matters... when adding new code, put elements that depend on
# others AFTER the dependency! (e.g. libbin needs libhdfutils, so libhdfutils
# goes first...)


# libraries
add_subdirectory(libanc)
add_subdirectory(libczcs)
add_subdirectory(libl2)
add_subdirectory(libmap)
add_subdirectory(libmeris)
add_subdirectory(libgoci)
add_subdirectory(libseawifs)
add_subdirectory(libswfnav)
add_subdirectory(libosmi)
add_subdirectory(liboli)
add_subdirectory(libbilio)
add_subdirectory(libimageutils)

# Common progs
add_subdirectory(l2gen)
add_subdirectory(l2brsgen)
add_subdirectory(l2bin)
add_subdirectory(l3bin)
add_subdirectory(l1aextract_modis)
add_subdirectory(l1aextract_seawifs)
add_subdirectory(l1bextract_meris)
add_subdirectory(l2extract)
add_subdirectory(l2mapgen)
add_subdirectory(l3bindump)
add_subdirectory(get_product_info)
add_subdirectory(l3mapgen)
add_subdirectory(nccmp)
add_subdirectory(val_extract)

# MODIS-specific
add_subdirectory(l1agen_modis)
add_subdirectory(l1bgen_modist)
add_subdirectory(l1bgen_modisa)
add_subdirectory(geogen_modis)
add_subdirectory(l0fix_modis)
add_subdirectory(l0cnst_write_modis)
add_subdirectory(l0chunk_modis)
add_subdirectory(l1asubset_modis)
add_subdirectory(atteph_info_modis)
add_subdirectory(geocheck_modis)
add_subdirectory(pdsmerge)

if (SEADAS_EXPORT)
  add_subdirectory(l1agen_viirs)
  add_subdirectory(geolocate_viirs)
  add_subdirectory(calibrate_viirs)
else (SEADAS_EXPORT)
  add_subdirectory(smigen)
  add_subdirectory(smitoppm)
  add_subdirectory(aviris2oci)
  add_subdirectory(aviris2ncdf)
  add_subdirectory(prism2oci)
  add_subdirectory(prismbil2oci)
  add_subdirectory(hicoENVI)
  add_subdirectory(l1bgen_hico)

  # VIIRS QC programs
  add_subdirectory(l0qc_viirs)
  add_subdirectory(l2qc_viirs)

  if (BUILD_MISC)
    add_subdirectory(l0cnst_read_modis)
    # Ancillary-specific
    add_subdirectory(met_reverse)
    add_subdirectory(auto_qc)
    add_subdirectory(oisst_info)
    add_subdirectory(ancnrt)
    #add_subdirectory(ice2hdf)
    #  Miscellaneous
    add_subdirectory(landbin)
    add_subdirectory(bindepths)
    add_subdirectory(biosmap)
    add_subdirectory(hico_utils)
    add_subdirectory(geogen_hico)
    #  add_subdirectory(l3despeckle)
    add_subdirectory(get_utm_zone)
    add_subdirectory(darktargetc)
    add_subdirectory(anctools)
    add_subdirectory(l3bstats)
  endif(BUILD_MISC)

  if (BUILD_AHMAD_FRASER)
    add_subdirectory(afocn)
    add_subdirectory(afphs)
    add_subdirectory(afrt1)
    add_subdirectory(afrt2)
  endif(BUILD_AHMAD_FRASER)

  if (BUILD_HISTORICAL)
    add_subdirectory(l1agen_czcs)
    add_subdirectory(l1agen_seawifs)
    add_subdirectory(orbnum_seawifs)
    add_subdirectory(gpsextract_seawifs)
    add_subdirectory(neb2raw_seawifs)
    add_subdirectory(raw2l0_seawifs)
    add_subdirectory(ql02raw_seawifs)
    add_subdirectory(tlmgen_seawifs)
    add_subdirectory(l0regen_seawifs)
    add_subdirectory(viirs_sim_sdr)
    add_subdirectory(modis_timestamp)

    # These are commented out since they are the only programs that use
    # the HDF4 Fortran API.  To build them you need to enable Fortran
    # when building HDF4
    #
    #add_subdirectory(interpnav_seawifs)
    #add_subdirectory(navassess_seawifs)

  endif(BUILD_HISTORICAL)

endif(SEADAS_EXPORT)
